Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 24, 2025

Summary

This PR adds support for displaying base64 encoded images returned by MCP tools, fixing the issue where Roo Code couldn't display images from tools like webpage-screenshot-mcp.

Changes

  • Updated processToolContent in useMcpToolTool.ts to handle image content types
  • Modified the function to return both text and images array
  • Added proper base64 data URI construction for images (handles both with and without data URI prefix)
  • Updated executeToolAndProcessResult to pass images to both cline.say and pushToolResult
  • Added comprehensive tests for single and multiple image handling

Testing

  • Added unit tests for image handling in MCP tool responses
  • All existing tests continue to pass
  • Verified that images are properly formatted as base64 data URIs

Fixes #6163


Important

Adds support for processing and displaying base64 encoded images in MCP tool responses, with updated tests to verify functionality.

  • Behavior:
    • useMcpToolTool in useMcpToolTool.ts now processes base64 encoded images in tool responses, appending them to the result text.
    • Updates processToolContent to extract and format image data, returning both text and image arrays.
    • executeToolAndProcessResult now handles images, sending them with the response.
  • Tests:
    • Adds test cases in useMcpToolTool.spec.ts for handling tool responses with single and multiple images.
    • Mocks formatResponse.toolResult to include image count in the result string.
  • Misc:
    • Fixes del #6163 by adding image support to MCP tool responses.

This description was created by Ellipsis for 9503e43. You can customize this summary. It will automatically update as commits are pushed.

- Update processToolContent to handle image content types
- Construct proper base64 data URIs for images
- Pass images array to cline.say and pushToolResult
- Add comprehensive tests for image handling

Fixes #6163
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 24, 2025 10:00
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 24, 2025
@roomote roomote bot mentioned this pull request Jul 24, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 24, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 25, 2025
@daniel-lxs
Copy link
Member

Related to #5185

@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 25, 2025
@daniel-lxs
Copy link
Member

Closing in favor of 5185

@daniel-lxs daniel-lxs closed this Jul 30, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Jul 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

del

4 participants